#include "stdafx.h"
#include "wf_optionsdrawing.h"

#include "pf_snapper.h"
#include "pf_graphicview.h"



WF_OptionsDrawing::WF_OptionsDrawing(PF_Container& container,
        PF_GraphicView& graphicView)
        :PF_ActionInterface("Drawing Options",
                    container, graphicView) {
}


QAction* WF_OptionsDrawing::createGUIAction(LX_Define::ActionType /*type*/, QObject* /*parent*/) {
	// tr("Drawing")
	QAction* action = new QAction(tr("Current &Drawing Preferences"), NULL);
// Preferences shortcut was itroduced on 4.6
#if QT_VERSION >= 0x040600
	action->setShortcut(QKeySequence::Preferences);
#endif 
	//action->zetStatusTip(tr("Settings for the current Drawing"));
    return action;
}


void WF_OptionsDrawing::init(int status) {
    PF_ActionInterface::init(status);

    trigger();
}



void WF_OptionsDrawing::trigger() {
    if (graphic!=NULL) {
        PF_DIALOGFACTORY->requestOptionsDrawingDialog(*graphic);
        PF_DIALOGFACTORY->updateCoordinateWidget(PF_Vector(0.0,0.0),
                PF_Vector(0.0,0.0),
                true);
        graphicView->redraw(LX_Define::RedrawGrid);
        graphicView->redraw(LX_Define::RedrawDrawing); 
    }
    finish();
}


// EOF
